<?php
namespace Home\Model;
use Think\Model;
class UserModel extends Model{
	public function checkUser($userId,$pwd){
		$data = $this->field('UserId','Password','UserName')->where(array('UserId'=>$userId))->find();
        if ($data===null) {
        	return '用户名不存在';
        }
        if ($data['Password']==$pwd) {
        	session('userId',$userId);  //关联 把userId传递到公共控制器 判断用户是否已经登录
        	session('userName',$data['UserName']);
        	return true;
        }
        return '密码错误，请重新登录';
	}
}
?>